//
//  ShoppingMallCell.m
//  MJApp
//
//  Created by John on 15/3/31.
//  Copyright (c) 2015年 wangliang. All rights reserved.
//

#import "ShoppingMallCell.h"
@interface ShoppingMallCell()
@property (weak, nonatomic) IBOutlet UIImageView *image;
@property (weak, nonatomic) IBOutlet UILabel *info;
@property (weak, nonatomic) IBOutlet UILabel *price;

@end
@implementation ShoppingMallCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+(instancetype)cellForTableview:(UITableView *)tableview{

    static NSString * ID = @"ShoppingMallCell";
    ShoppingMallCell * cell = [tableview dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[NSBundle mainBundle] loadNibNamed:ID owner:nil options:nil].lastObject;
    }
    cell.cellH = 117;
    return cell;
}

- (void)setFrame:(CGRect)frame{

    frame.origin.x += 10;
    frame.size.height -= 20;
    frame.size.width -= 20;
    frame.origin.y += 20;
    [super setFrame: frame];
    
}
- (void)setInfoDic:(NSDictionary *)infoDic{
    [super setInfoDic:infoDic];
    
    if ([infoDic[@"images"] count] > 0) {
        NSString * urlStr = [NSString stringWithFormat:@"%@%@",kUrl,infoDic[@"images"][0][@"image"]];
        [self.image sd_setImageWithURL:[NSURL URLWithString:urlStr] placeholderImage:nil];
    }
    
    
    self.price.text = [NSString stringWithFormat:@"￥%@",infoDic[@"price_low"]];
    self.info.text = infoDic[@"name"];
    NSLog(@"%@",infoDic);
}
@end
